<script>
import $ from 'jquery'
import ljmodal from '@/component/modal.vue'
export default {
    name: 'app',
    components: {
        ljmodal
    },
    data () {
        return {
            title: '',
            key: '',
            list: new Object,
            task: {
                'title': ['任务标题', 1],
                'state': ['状态', 1],
                'timeW': ['计划完成时间', 1],
                'timeF': ['计划发布时间', 1],
                'need': ['需求方', 1],
                'hour': ['预估工时', 1],
                'jira': ['任务编号', 1],
                'worker': ['开发负责人', 1],
                'remark': ['需求相关说明', 1]
            },
            script: {
                'desc': ['用途', 1],
                'name': ['名称', 1],
                'time': ['定时', 1],
                'class': ['分类', 1],
                'state': ['状态', 1]
            },
            zlscript: {
                'desc': ['用途', 1],
                'name': ['名称', 1],
                'time': ['定时', 1],
                'class': ['分类', 1],
                'state': ['状态', 1]
            },
        }
    },
    methods: {
        add () {
            var path = this.$route.path
            var type = Object.prototype.toString
            path = path.split("/")

            if (type.call(path) == "[object Array]") {
                this.key = path[path.length - 1]
                this.list = Object.assign({}, this.list, this[this.key])

                $('#add').modal('show')
            } else {
                alert("localStorage key path not exists")
            }
        }
    }
}
</script>

<template>
    <div id="app" style="margin: 20px auto; width: 1500px; font-size: 12px;">
        <router-link to="/" class="btn btn-primary">首页</router-link>
        <button @click="add" style="margin-left: 10px;" class="btn btn-primary" data-toggle="modal">新增</button>
        <router-view style="margin-top: 10px;"></router-view>

        <ljmodal id="add" :list="list" :index="key"></ljmodal>
    </div>
</template>
